package com.ling.tools.login.utils;

/**
 * File Name: ResultCode
 * Date: 2020/2/28 14:18
 * Author: Ling
 * Description  返回结果code和message
 */
public enum ResultCode {

    /* 成功/失败状态码 */
    SUCCESS(0,"成功"),
    FAIL(1,"失败"),

    /*参数错误：20001-29999*/
    PARAM_IS_BLANK(10001,"参数为空"),

    /*用户注册登录错误：30001-39999*/
    USER_ALREADY_EXISTS(20001,"用户已经存在"),
    USER_DOSENOT_EXISTS(20002,"用户不存在"),
    USER_NOT_LOGGED_IN(20003,"用户未登录"),
    USER_LOGIN_ERROR(20004,"账号或密码错误"),
    USER_REGISTER_ERROR(20005,"用户注册失败"),
    USER_USERINFO_NOT_BLANK(20006,"用户信息不能为空"),

    /* 系统错误： 40001-49999 */
    SYSTEM_INNER_ERROR(40001,"啊哦^o^,系统繁忙请稍后再试");


    ResultCode(Integer code) {
        this.code = code;
    }

    ResultCode(String message) {
        this.message = message;
    }


    private Integer code;

    private String message;

    ResultCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer code() {
        return this.code;
    }

    public String message() {
        return this.message;
    }


    @Override
    public String toString() {
        return this.name();
    }

}
